version 12.1

******** FIGURE A9 Awkward choices for right-wing respondents
use data.dta, clear

*****  Setting the mean or modal values of respondent-level variables that are typical for right-wing respondents
* left_right = 10
scalar h_leftright=10

* pol_interest = 3.5
sum pol_interest if pol_interest!=. & left_right==10 & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_pinterest=3.5
* edu_imp = 3
sum edu_imp if pol_interest!=. & left_right==10 & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_eduimp=3
* inc_imp = 1.7
sum inc_imp if pol_interest!=. & left_right==10 & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_incimp=1.7
* hon_imp = 3.5
sum hon_imp if pol_interest!=. & left_right==10 & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_honimp=3.5
* taxspend_imp = 3.8
sum taxspend_imp if pol_interest!=. & left_right==10 & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & taxspend_imp!=. & samesex_imp!=. & Y!=.
scalar h_taximp=3.8
* samesex_imp = 3.7
sum samesex_imp if pol_interest!=. & left_right==10 & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & taxspend_imp!=. & samesex_imp!=. & Y!=.
scalar h_sseximp=3.7 

***** Setting the mean or modal values for the other respondent-level variables (unchanged from analysis of typical respondent)
* gender =0 (female)
table gender if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_gender=0
* age = 21.4
sum age if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_age=21.4
* italian = 1
table italian if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_italian=1
* student = 1
table ftstudent if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_student=1
* lyceum = 1
table lyceum if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_lyceum=1
* survey =1 (2013)
table survey if pol_interest!=. & left_right!=.n & gender!=. & age!=. & italian!=. & ftstudent!=. & lyceum!=. & edu_imp!=. & inc_imp!=. & hon_imp!=. & Y!=.
scalar h_survey=1

************** Profile comparison
* University education, middle income, corrupt, keep tax-spend, some rights
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
scalar edu2=0
scalar edu3=1
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=1
scalar tax2=1
scalar tax3=0
scalar sex2=1
scalar sex3=0
generate x_betahat0 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
* University education, middle income, clean, more tax-spend, same rights
scalar edu2=0
scalar edu3=1
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=0
scalar tax2=0
scalar tax3=0
scalar sex2=0
scalar sex3=0
generate x_betahat1 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim.dta, clear
save sim2.dta, replace
restore, not

************** Profile comparison
* University education, middle income, investigated, keep tax-spend, some rights
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
scalar edu2=0
scalar edu3=1
scalar inc2=1
scalar inc3=0
scalar cor2=1
scalar cor3=0
scalar tax2=1
scalar tax3=0
scalar sex2=1
scalar sex3=0
generate x_betahat0 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
* University education, middle income, clean, more tax-spend, same rights
scalar edu2=0
scalar edu3=1
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=0
scalar tax2=0
scalar tax3=0
scalar sex2=0
scalar sex3=0
generate x_betahat1 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not

************** Profile comparison
* Junior high education, middle income, clean, keep tax-spend, some rights
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
scalar edu2=0
scalar edu3=0
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=0
scalar tax2=1
scalar tax3=0
scalar sex2=1
scalar sex3=0
generate x_betahat0 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
* University education, middle income, clean, more tax-spend, same rights
scalar edu2=0
scalar edu3=1
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=0
scalar tax2=0
scalar tax3=0
scalar sex2=0
scalar sex3=0
generate x_betahat1 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
restore, not

************** Profile comparison
* High education, middle income, clean, keep tax-spend, some rights
estimates use m10.ster
est des
preserve
drawnorm MG_b1-MG_b123, n(10000) means(e(b)) cov(e(V)) clear seed(1)
postutil clear
postfile mypost prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi using sim.dta, replace
noisily display "start"
scalar edu2=1
scalar edu3=0
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=0
scalar tax2=1
scalar tax3=0
scalar sex2=1
scalar sex3=0
generate x_betahat0 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
* University education, middle income, clean, more tax-spend, same rights
scalar edu2=0
scalar edu3=1
scalar inc2=1
scalar inc3=0
scalar cor2=0
scalar cor3=0
scalar tax2=0
scalar tax3=0
scalar sex2=0
scalar sex3=0
generate x_betahat1 = MG_b2*edu2 + MG_b3*edu3 + MG_b5*inc2 + MG_b6*inc3 + MG_b8*cor2 + MG_b9*cor3 + MG_b11*tax2 + MG_b12*tax3 + MG_b14*sex2 + MG_b15*sex3 ///
+ MG_b16*edu2*h_pinterest + MG_b17*edu3*h_pinterest + MG_b18*inc2*h_pinterest + MG_b19*inc3*h_pinterest + MG_b20*cor2*h_pinterest + MG_b21*cor3*h_pinterest ///
+ MG_b22*edu2*h_leftright + MG_b23*edu3*h_leftright + MG_b24*inc2*h_leftright + MG_b25*inc3*h_leftright + MG_b26*cor2*h_leftright + MG_b27*cor3*h_leftright ///
+ MG_b28*edu2*h_gender + MG_b29*edu3*h_gender + MG_b30*inc2*h_gender + MG_b31*inc3*h_gender + MG_b32*cor2*h_gender + MG_b33*cor3*h_gender ///
+ MG_b34*edu2*h_age + MG_b35*edu3*h_age + MG_b36*inc2*h_age + MG_b37*inc3*h_age + MG_b38*cor2*h_age + MG_b39*cor3*h_age ///
+ MG_b40*edu2*h_italian + MG_b41*edu3*h_italian + MG_b42*inc2*h_italian + MG_b43*inc3*h_italian + MG_b44*cor2*h_italian + MG_b45*cor3*h_italian ///
+ MG_b46*edu2*h_student + MG_b47*edu3*h_student + MG_b48*inc2*h_student + MG_b49*inc3*h_student + MG_b50*cor2*h_student + MG_b51*cor3*h_student ///
+ MG_b52*edu2*h_lyceum + MG_b53*edu3*h_lyceum + MG_b54*inc2*h_lyceum + MG_b55*inc3*h_lyceum + MG_b56*cor2*h_lyceum + MG_b57*cor3*h_lyceum ///
+ MG_b58*edu2*h_eduimp + MG_b59*edu3*h_eduimp + MG_b60*inc2*h_incimp + MG_b61*inc3*h_incimp + MG_b62*cor2*h_honimp + MG_b63*cor3*h_honimp ///
+ MG_b64*tax2*h_pinterest + MG_b65*tax3*h_pinterest + MG_b66*sex2*h_pinterest + MG_b67*sex3*h_pinterest ///
+ MG_b68*tax2*h_leftright + MG_b69*tax3*h_leftright + MG_b70*sex2*h_leftright + MG_b71*sex3*h_leftright ///
+ MG_b72*tax2*h_gender + MG_b73*tax3*h_gender + MG_b74*sex2*h_gender + MG_b75*sex3*h_gender ///
+ MG_b76*tax2*h_age + MG_b77*tax3*h_age + MG_b78*sex2*h_age + MG_b79*sex3*h_age ///
+ MG_b80*tax2*h_italian + MG_b81*tax3*h_italian + MG_b82*sex2*h_italian + MG_b83*sex3*h_italian ///
+ MG_b84*tax2*h_student + MG_b85*tax3*h_student + MG_b86*sex2*h_student + MG_b87*sex3*h_student ///
+ MG_b88*tax2*h_lyceum + MG_b89*tax3*h_lyceum + MG_b90*sex2*h_lyceum + MG_b91*sex3*h_lyceum ///
+ MG_b92*tax2*h_taximp + MG_b93*tax3*h_taximp + MG_b94*sex2*h_sseximp + MG_b95*sex3*h_sseximp ///
+ MG_b100*edu2*tax2 + MG_b101*edu2*tax3 + MG_b103*edu3*tax2 + MG_b104*edu3*tax3 ///
+ MG_b109*edu2*sex2 + MG_b110*edu2*sex3 + MG_b112*edu3*sex2 + MG_b113*edu3*sex3 ///
+ MG_b114*edu2*h_survey + MG_b115*edu3*h_survey + MG_b116*inc2*h_survey + MG_b117*inc3*h_survey + MG_b118*cor2*h_survey + MG_b119*cor3*h_survey ///
+ MG_b120*tax2*h_survey + MG_b121*tax3*h_survey + MG_b122*sex2*h_survey + MG_b123*sex3*h_survey
gen prob0=normal(x_betahat0)
gen prob1=normal(x_betahat1)
gen diff=prob1-prob0
egen probhat0=mean(prob0)
egen probhat1=mean(prob1)
egen diffhat=mean(diff)
tempname prob_hat0 lo0 hi0 prob_hat1 lo1 hi1 diff_hat diff_lo diff_hi   
_pctile prob0, p(2.5,97.5) 
scalar `lo0' = r(r1)
scalar `hi0' = r(r2)  
_pctile prob1, p(2.5,97.5)
scalar `lo1'= r(r1)
scalar `hi1'= r(r2)  
_pctile diff, p(2.5,97.5)
scalar `diff_lo'= r(r1)
scalar `diff_hi'= r(r2)  
scalar `prob_hat0'=probhat0
scalar `prob_hat1'=probhat1
scalar `diff_hat'=diffhat
post mypost (`prob_hat0') (`lo0') (`hi0') (`prob_hat1') (`lo1') (`hi1') (`diff_hat') (`diff_lo') (`diff_hi')
drop x_betahat0 x_betahat1 prob0 prob1 diff probhat0 probhat1 diffhat 
display ""
postclose mypost
use sim2.dta, clear
append using sim.dta
save sim2.dta, replace
gen MV = _n

eclplot diff_hat diff_hi diff_lo MV, hor estopts(msize(small)) rplottype(rspike) ciopts(msize(small)) graphregion(fcolor(white)) ysca(noline) xsca(r(-1/0.9)) ytitle ("") xtitle(Marginal effect, size(2)) ///
ylabel(1 "            " 2 " " 3 " " 4 " ", noticks labsize(2)) ///
xlabel(.25 "0.25" 0 -.25 "-0.25" -.5 "-0.5" -.75 "-0.75", noticks labsize(2)) xline(0, lcolor(black) lwidth(medthin)) ///
text(1 -1 "university" "{it:corrupt}" "{it:keep tax-spend}" "{it:some rights}", place(c) just(center) size(2)) ///
text(2 -1 "university" "{it:investigated}" "{it:keep tax-spend}" "{it:some rights}", place(c) just(center) size(2)) ///
text(3 -1 "{it:junior high}" "clean" "{it:keep tax-spend}" "{it:some rights}", place(c) just(center) size(2)) ///
text(4 -1 "{it:high school}" "clean" "{it:keep tax-spend}" "{it:some rights}", place(n) just(center) size(2)) ///
text(1 0.15 "university" "{it:clean}" "{it:more tax-spend}" "{it:same rights}", place(c) just(center) size(2)) ///
text(2 0.15 "university" "{it:clean}" "{it:more tax-spend}" "{it:same rights}", place(c) just(center) size(2)) ///
text(3 0.15 "{it:university}" "clean" "{it:more tax-spend}" "{it:same rights}", place(c) just(center) size(2)) ///
text(4 0.15 "{it:university}" "clean" "{it:more tax-spend}" "{it:same rights}", place(n) just(center) size(2)) ///
saving(Figure_A9.gph, replace)
exit
